﻿// (c) Copyright 2013 Mike Riedel.
// This source is subject to the Microsoft Public License (Ms-PL).
// All other rights reserved.

namespace FreshMeat.Storage
{
   /// <summary>
   /// Provides serialization and deserialization.
   /// Methods are thread safe.
   /// </summary>
   public interface ISerializer<T>
   {
      /// <summary>
      /// Serializes an object to a string.
      /// Method is thread safe.
      /// </summary>
      /// <param name="value">Item to serialize.</param>
      /// <returns>String containing the serialized data.</returns>
      string Serialize(T value);

      /// <summary>
      /// Deserializes an object from a stream.
      /// Method is thread safe.
      /// </summary>
      /// <param name="data">The string containing the serialized data.</param>
      /// <returns>The deserialized object.</returns>
      T Deserialize(string data);
   }
}
